#ifndef FILENOTIFY_H
#define FILENOTIFY_H

#include <QObject>
#include <QString>
#include <QDir>
#include <QMap>
#include <QVector>
#include <QTimer>
#include "mediaconverter.h"
#include "mediaprobe.h"

class fileNotify : public QObject
{
    Q_OBJECT
public:
    fileNotify(QString xmlmetadataPath, QString sourcePath, QString destinationPath, int threads, QObject *parent = 0);
    ~fileNotify();
    enum TASKSTATUS{INIT = 0, TS2MP4, TS2MP4_END, MP42HLS};
    void scan(void);
    bool sourceDirExists(void);
    bool destinationDirExists(void);
private slots: 
    void timerExpired();
    void progressRefreshed(int percentage);
    void finished(int exitcode);
private:
    QDir                    m_xmlMetadataDir;
    QDir                    m_SourceDir;
    QDir                    m_DestinationDir;
    QDir                    m_realDestinationDir;
    int                     m_theadNumber;
    QMap<QString,QString>   m_finishMap;
    QMap<QString,QString>   m_failedMap;
    QVector<QString>        m_preparingVector;

    QTimer                  m_timer;

    MediaConverter          *m_converter;
    MediaProbe              *m_probe;
    ConversionParameters    m_para;
    QString                 m_mpeg2Option;
    QString                 m_hlsOption;
    QString                 m_hlsOption_1200k;
    QString                 m_hlsOption_800k;
    QString                 m_hlsOption_400k;
    TASKSTATUS              m_status;

    QVector<QString>        m_rateVersion;
};

#endif

